import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-myc11',
  templateUrl: './myc11.component.html',
  styleUrls: ['./myc11.component.css']
})
export class Myc11Component implements OnInit {

  public keyword: string = '';
  public historyList: any[] = [];
  public todoList: any[] = [];
  constructor() { }

  ngOnInit(): void {
  }
  doSearch() {
    // console.log(this.keyword);
    if (!this.historyList.includes(this.keyword)) {
      this.historyList.push(this.keyword);
    }
  }
  deleteHistory(i: number) {
    // console.log(i);
    this.todoList.splice(i, 1);

  }
  doAdd(e: any) {
    if (e.keyCode == 13) {
      this.todoList.push({
        title: this.keyword,
        status: 0
      })
    }
  }
}
